var trace = {
    x: [1], y: [2],
    mode: 'markers',
    type: 'scatter'
};
var layout = {
    title: '2D Scatter Plot'
};
Plotly.newPlot('plot', [trace], layout);


function updatePlotlyChart() {
    var data = [{
        x: tableData.map((data) => data.name),
        y: tableData.map((data) => data.age),
        type: 'bar'
    }];
    
    var layout = {
        title: 'Plotly图表'
    };
    
    Plotly.newPlot('plotlyChart', data, layout);
}
// setInterval(function(){
//     fetch('http://localhost:8000/data')
//     .then(response => response.json())
//     .then(data => {
//         Plotly.extendTraces('plot', { x: [[data.x]], y: [[data.y]], z: [[data.z]] }, [0]);
//     });
// }, 1000); // 更新频率为每秒